package com.ic.common;

import com.ic.domain.Rule;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
@NoArgsConstructor
public class RuleContext {
    private String version;
    private String id;
    private String name;
    private Integer triggerNum; //单位时间内触发次数
    private Integer during;
    private Date triggerStart; //上次触发时间
    private Integer matchNum; //单位时间内匹配次数
    private Integer matchDuring;
    private Date matchStart; //上次匹配时间
    private String expression;


    public RuleContext(Rule r) {
        this.version = r.getVersion();
        this.id = r.getId();
        this.name = r.getName();
        this.during = r.getDuring();
        this.matchDuring = r.getMatchDuring();
        this.triggerNum = 0;
        this.matchNum = 0;
    }
}
